import Vue from 'vue'
import App from '@/App'
import config from '@/config/index.js'
import utils from '@/utils/index.js'
import assets from '@/utils/assets.js'
import store from '@/store/index.js'
import wlog from '@/utils/wlog.js'
import api from '@/api/index.js'
import {
	configList
} from '@/api/luch-request.js'
import _cloneDeep from 'lodash/cloneDeep'
import _intersection from 'lodash/intersection'
import _map from 'lodash/map'

import {
	Base64
} from '@/js_sdk/js-base64/base64.min.js'
import uView from '@/components/uview-ui'
import dayjs from '@/js_sdk/dayjs/dayjs.min.js'
import XEUtils from '@/js_sdk/xe-utils/xe-utils.umd.min.js'
import AudioUtil from '@/utils/AudioUtil.js'
import order from '@/utils/order.js'

Vue.use(uView)

Vue.prototype.$config = config
Vue.prototype.$utils = utils
Vue.prototype.$assets = assets
Vue.prototype.$store = store
Vue.prototype.$api = api
Vue.prototype.$_cloneDeep = _cloneDeep
Vue.prototype.$_intersection = _intersection
Vue.prototype.$_map = _map
Vue.prototype.$Base64 = Base64
Vue.prototype.$dayjs = dayjs
Vue.prototype.$XEUtils = XEUtils
Vue.prototype.$AudioUtil = AudioUtil
Vue.prototype.$wlog = wlog
Vue.prototype.$order = order

//系统错误全局捕获，如果是ajax异步请求，异常需要通过this.$throw(error)手动抛出
const errorHandler = (error, vm) => {
	console.error('===抛出全局异常===', vm, error)
}

Vue.config.errorHandler = errorHandler
Vue.prototype.$throw = (error) => errorHandler(error, this)

Vue.config.productionTip = false

App.mpType = 'app'

const app = new Vue({
	...App
})
app.$mount()
